package org.darkforest.admin.schedule;

import org.darkforest.common.services.HealthUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class HealthUserTask {

    Logger logger = LoggerFactory.getLogger(HealthUserTask.class);

    @Autowired
    private HealthUserService healthUserService;

    /***
     * 检查处于"未预约"状态的体检用户的年龄，判断其套餐类型是否需要改变
     * 每天00:01:00执行一次
     */
    @Scheduled(cron = "0 1 0 * * ?")
    public void changePkgType() {
        logger.info("----------------- changePkgType -----------------");
        healthUserService.changePkgTypeBySchedule();
    }
}
